package com.liuyi.netty.im.commons.codes.data.event.message.playload;

import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;

/**
 * 图片类型消息载体
 *
 * @author Mr.Fmy
 * @since 2021-12-08
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class PlayloadImage extends Playload implements Serializable {

    private static final long serialVersionUID = 2161761772960424956L;

    /**
     * 略缩图
     */
    private String shrinkageUrl;

    /**
     * 原图，可以不存在
     */
    private String masterUrl;

    @Override
    public String getText() {
        return "[图片]";
    }


    public static final class PlayloadImageBuilder {
        private String shrinkageUrl;
        private String masterUrl;
        private String text;

        private PlayloadImageBuilder() {
        }

        public static PlayloadImageBuilder aPlayloadImage() {
            return new PlayloadImageBuilder();
        }

        public PlayloadImageBuilder shrinkageUrl(String shrinkageUrl) {
            this.shrinkageUrl = shrinkageUrl;
            return this;
        }

        public PlayloadImageBuilder masterUrl(String masterUrl) {
            this.masterUrl = masterUrl;
            return this;
        }

        public PlayloadImage build() {
            PlayloadImage playloadImage = new PlayloadImage();
            playloadImage.setShrinkageUrl(shrinkageUrl);
            playloadImage.setMasterUrl(masterUrl);
            playloadImage.setText(text);
            return playloadImage;
        }
    }
}
